package dao.impl;

import dao.BaseDao;
import dao.WalletTypeDao;
import entity.Wallet;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class WalletTypeDaoImpl extends BaseDao implements WalletTypeDao {
    Connection conn;
    PreparedStatement pstmt;
    ResultSet rs;
    @Override
    public ResultSet selectWalletType(int uid) {
        String sql = "SELECT * FROM wallettype wt,wallet w\n" +
                "WHERE wt.`wtid` = w.`wtid`\n" +
                "AND w.`uid` = ?;";
        conn = getConnection();
        try {
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1,uid);
            rs = pstmt.executeQuery();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return rs;
    }
}
